import { defineStore } from "pinia";
import EStore from "./index.enum";
import { storage } from "@/core/storage";
import { EStorage } from "@/core/storage.enum";

export default defineStore({
  id: EStore.UseCommonStore,
  state: () => ({
    /** 用户令牌 */
    token: "",
  }),
  actions: {
    setToken(token: string) {
      this.token = token;
      storage.set(EStorage.token, token);
    },
  },
});
